package com.ddh.service.controller;


import com.ddh.service.common.BaseEntity;
import com.ddh.service.common.Result;
import com.ddh.service.domain.game.dto.GameDTO;
import com.ddh.service.domain.game.dto.GamePageDTO;
import com.ddh.service.domain.game.entity.Games;
import com.ddh.service.service.IGamesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ddh
 * @since 2025-01-16
 */
@RestController
@RequestMapping("/games")
@Api(tags = "游戏")
public class GamesController {

    @Resource
    private IGamesService gamesService;

    @PostMapping("/addGame")
    @ApiOperation("新增游戏题目")
    public Result<Boolean> addGame(@RequestBody GameDTO gameDTO) {
        Boolean result=gamesService.addGame(gameDTO);
        return  Result.success(result);
    }

    @ApiOperation("分页查询游戏题目")
    @PostMapping("/selectPageGame")
    public Result<BaseEntity<Games>> selectPageGame(GamePageDTO gamePageDTO) {
        BaseEntity<Games> gamesBaseEntity=gamesService.selectPageGame(gamePageDTO);
        return  Result.success(gamesBaseEntity);
    }



}
